import java.util.Scanner;

public class TestDemo {
    public static int fib(int n){
        if(n<=2){
            return 1;
        }else{
            int a = 1;
            int b = 1;
            int c = a+b;
            while(n!=3){
                a = b;
                b = c;
                c = a+b;
                n--;
            }
            return c;
        }
    }
    public static void main(String[] args) {
        //求斐波那契数列的第n项。(迭代实现)
        int n = 7;
        System.out.println(fib(n));
    }
    public static int intMax(int x,int y){
        return ((x>y)?x:y);
    }
    public static double doubleMax(double x,double y,double z){
      return ( ( ((x>y)?x:y)>z)?((x>y)?x:y):z);
    }
    public static void main6(String[] args) {
        int a = 5;
        int b = 6;
        double c = 3.4;
        double d = 5.8;
        double f = 4.8;
        System.out.println(intMax(a,b));
        System.out.println(doubleMax(c,d,f));
    }
    public static int sum(int x,int y){
        return x+y;
    }
    public static double sum(double x,double y,double z){
        return x+y+z;
    }
    public static void main5(String[] args) {
        int a = 5;
        int b = 6;
        double c = 3.4;
        double d = 5.8;
        double f = 4.8;
        System.out.println(sum(a,b));
        System.out.println(sum(c,d,f));
    }
    //每个数的阶乘
    public static int fac1(int i){
        int ret = 1;
        for (int j = 1; j <=i ; j++) {
            ret *= j;
        }
        return ret;
    }
    //阶乘和
    public static int sumFac(int n){
        int sum = 0;
        for (int i = 1; i <=n ; i++) {
            sum += fac1(i);
        }
       return sum;
    }
    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        System.out.println(sumFac(n));

    }
    public static int max3(int x,int y,int z){
        int ret = max2(x,y);
        return (ret > z) ? ret : z;

    }
    public static int max2(int x,int y){
        return (x > y) ? x : y;
    }
    public static void main3(String[] args) {
        int a = 10;
        int b = 20;
        int c = 5;
        System.out.println(max3(a,b,c));
    }
    public static int add(int x,int y){
        return x+y;
    }
    //个数不同
    public static int add(int x,int y,int z){
        return x+y;
    }
    //数据类型不一样
    public static double add(double x,int y){
        return x+y;
    }
    //不同数据类型的顺序不同
    public static double add(int y,double x){
        return x+y;
    }

    public static void main2(String[] args) {
        int a = 10;
        int b = 20;
        int ret = add(a,b);
        System.out.println(ret);


    }
    //求每个数的阶乘
    public static int fac(int i){
        int ret = 1;
        for (int j = 1; j <= i; j++) {
            ret *= j;
        }
        return ret;
    }
    //求阶乘和
    public static int sum(int n){
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += fac(i);
        }
        return sum;

    }
    public static void main1(String[] args) {
        //用函数实现1-n的阶乘的和。

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        System.out.println(sum(n));
        scan.close();
    }
}
